home *** CD-ROM | disk | FTP | other *** search
/ Sprite 1984 - 1993 / Sprite 1984 - 1993.iso / src / cmds / nfsmount / nfs.h < prev    next >
Encoding:
C/C++ Source or Header  |  1991-10-20  |  3.8 KB  |  145 lines

  1. /*
  2.  * nfs.h --
  3.  *    Definitions for the Sprite user-level NFS interface.  A Sprite process
  4.  *    runs as the server of a Sprite pseudo-filesystem that provides
  5.  *    access to a remote NFS filesystem.
  6.  *
  7.  * Copyright (C) 1987 Regents of the University of California
  8.  * All rights reserved.
  9.  * Permission to use, copy, modify, and distribute this
  10.  * software and its documentation for any purpose and without
  11.  * fee is hereby granted, provided that the above copyright
  12.  * notice appear in all copies.  The University of California
  13.  * makes no representations about the suitability of this
  14.  * software for any purpose.  It is provided "as is" without
  15.  * express or implied warranty.
  16.  *
  17.  *
  18.  * $Header: /sprite/src/cmds/nfsmount/RCS/nfs.h,v 1.8 91/10/20 12:38:26 mottsmth Exp $ SPRITE (Berkeley)
  19.  */
  20.  
  21. #include "sys/time.h"
  22. #include "rpc/rpc.h"
  23. #include "mount.h"
  24. #include "nfs_prot.h"
  25. #include "errno.h"
  26.  
  27. #undef SUCCESS
  28. #include "status.h"
  29. #include <kernel/fs.h>
  30. #include "pfs.h"
  31. #include "pdev.h"
  32.  
  33. extern char myhostname[];
  34.  
  35. /*
  36.  * Top-level state.  This has a NFS handle for the mount point,
  37.  * and state for the naming request-response protocol with the
  38.  * Sprite kernel.
  39.  */
  40. typedef struct {
  41.     char    *host;            /* Hostname of NFS server */
  42.     char    *nfsName;        /* NFS directory being mounted */
  43.     char    *prefix;        /* Prefix for pseudo-filesystem */
  44.     Pfs_Token    pfsToken;        /* Handle for Pfs library package */
  45.     CLIENT    *mountClnt;        /* Handle for SUN RPC to mount prog. */
  46.     nfs_fh    *mountHandle;        /* NFS handle from mount protocol */
  47.     CLIENT    *nfsClnt;        /* Handle for SUN RPC to nfs server */
  48. } NfsState;
  49.  
  50. /*
  51.  * Timeout period for SUN RPC.
  52.  */
  53. extern struct timeval nfsTimeout;
  54.  
  55. /*
  56.  * Open file table.
  57.  */
  58. typedef struct {
  59.     nfs_fh *handlePtr;        /* NFS file handle */
  60.     AUTH *authPtr;        /* NFS authentication */
  61.     int openFlags;        /* Saved open flags so we can remember
  62.                  * to do append-mode writes */
  63. } NfsOpenFile;
  64.  
  65. extern NfsOpenFile **nfsFileTable;
  66. extern NfsOpenFile **nextFreeSlot;
  67. extern int nfsFileTableSize;
  68.  
  69. /*
  70.  * Type mappings
  71.  */
  72. extern int nfsToSpriteFileType[];
  73. extern int spriteToNfsModeType[];
  74.  
  75. /*
  76.  * Internal types needed to differentiate between the NFS root,
  77.  * directories, regular files, and links.  The lookup routines have to
  78.  * recognize the root, and the read routine has to recognize directories,
  79.  * files, and links.
  80.  * This type is kept in the type field of the fileIDs we pass to the
  81.  * kernel each time an NFS file is opened.
  82.  *    TYPE_ROOT has to be zero because the Sprite kernel sets up the
  83.  *    fileID of our root to have all zero fields.
  84.  */
  85. #define TYPE_ROOT    0x0
  86. #define TYPE_DIRECTORY    0x1
  87. #define TYPE_FILE    0x2
  88. #define TYPE_SYMLINK    0x4
  89.  
  90. /*
  91.  * Macro to map Unix errno to Sprite int
  92.  */
  93. extern int nfsStatusMap[];
  94.  
  95. #define NfsStatusMap(errno) \
  96.     ((errno >= 0 && errno < sys_nerr) ? nfsStatusMap[errno] : errno)
  97.  
  98. /*
  99.  * Write-behind flag for testing.
  100.  */
  101. extern int nfs_PdevWriteBehind;
  102.  
  103. extern CLIENT *Nfs_MountInitClient();
  104. extern void Nfs_MountTest();
  105. extern void Nfs_MountDump();
  106. extern void Nfs_Unmount();
  107.  
  108. extern CLIENT *Nfs_InitClient();
  109. extern Pfs_CallBacks nfsNameService;
  110. extern Pdev_CallBacks nfsFileService;
  111. extern int BadProc();
  112.  
  113. extern int NfsOpen();
  114. extern int NfsClose();
  115. extern int NfsRead();
  116. extern int NfsWrite();
  117. extern int NfsIoctl();
  118. extern int NfsGetAttrStream();
  119. extern int NfsSetAttrStream();
  120. extern int NfsGetAttrPath();
  121. extern int NfsSetAttrPath();
  122. extern int NfsMakeDevice();
  123. extern int NfsMakeDir();
  124. extern int NfsRemove();
  125. extern int NfsRemoveDir();
  126. extern int NfsRename();
  127. extern int NfsHardLink();
  128. extern int NfsSymLink();
  129. extern int NfsDomainInfo();
  130.  
  131. extern void Nfs_UnmountAll();
  132. extern void Nfs_Exports();
  133. extern nfs_fh *Nfs_Mount();
  134.  
  135. extern int NfsRecordMountPointProc();
  136.  
  137. /*
  138.  * Attribute handling.
  139.  */
  140. extern void NfsToSpriteAttr();
  141. extern void SpriteToNfsAttr();
  142. extern void NfsToSpriteDirectory();
  143. extern void NfsFindCookie();
  144.  
  145.